import request from '@/utils/request'


// 确保token变量在使用前已经被正确获取
const token = localStorage.getItem('x-token') || 'your_default_token_here';

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/getInfo',
    method: 'get',
    headers: {
      'token':  token // 将token添加到请求头中
    }
  })
}


export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function register() {
  return request({
    url: '/user/add',
    method: 'post'
  })
}

export function update(data) {
  return request({
    url: '/user/update',
    method: 'post',
    data
  })
}

export function signout(userStaffId) {
  return request({
    url: '/user/delete',
    method: 'get',
    params: { userStaffId }, // 使用键值对格式传递参数
  });
}


// export function signout(userStaffId) {
//   return request({
//     url: '/user/delete',
//     method: 'post',
//     data: { userStaffId },
//   });
// }